package ar.uba.fi.tonyvaliente.signature;

public class JSHash extends HashFunction {

	public JSHash(int length) {
		super(length);
	}

	@Override
	public Number hash(String data) throws HashFunctionException {
		long hash = this.getSeed(); //1315423911

	      for(int i = 0; i < data.length(); i++)
	      {
	         hash ^= ((hash << 5) + data.charAt(i) + (hash >> 2));
	      }

	      return Math.abs(hash%this.getLength());
	}

}
